export default function (res) {
    const { body } = res;

    const reqBodySchema = JSON.parse(
        '{"description":"编辑员工岗位参数","type":"object","required":["recordId","startDate","userId"],"properties":{"userId":{"type":"integer","description":"员工ID","format":"int64"},"recordId":{"type":"integer","description":"岗位记录ID","format":"int64"},"positionLevel":{"title":"101-实习;103-初级;104-中级;105-高级;106-特级","type":"integer","description":"岗位级别   枚举值说明：101:实习103:初级104:中级105:高级106:特级:101-实习;103-初级;104-中级;105-高级;106-特级","format":"int32","enum":[101,103,104,105,106]},"startDate":{"type":"string","description":"任职开始日期","format":"date"}}}'
    );

    // 校验顶级必填参数
    if (reqBodySchema.required && reqBodySchema.required.length > 0) {
        for (const requiredField of reqBodySchema.required) {
            if (!body || !Object.prototype.hasOwnProperty.call(body, requiredField)) {
                return new Promise((resolve) => {
                    resolve({
                        code: 1,
                        message: `缺少必填参数：${requiredField}`,
                    });
                });
            }
        }
    }

    // 如果所有必填参数都存在，则生成 Mock 数据
    return new Promise((resolve) => {
        setTimeout(() => {
            resolve({
                code: 0,
                message: 'success',
                data: {}, // 业务数据是空对象，表示更新成功
                timestamp: Date.now(),
                requestId: 'requestId' + Math.floor(Math.random() * 1000),
                signature: 'signature' + Math.floor(Math.random() * 1000),
            });
        }, 100);
    });
}